package vn.edu.saigontech.ncms.model.system;

import java.sql.Time;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.hibernate.annotations.OptimisticLockType;

import vn.edu.saigontech.ncms.model.BaseEntity;
import vn.edu.saigontech.ncms.util.DateUtil;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true, optimisticLock = OptimisticLockType.ALL)
@Table(name = "ncms_shift")
@SuppressWarnings("serial")
public class Shift extends BaseEntity {
	
	public static String SHIFT_1 = "Session 1";
	public static String SHIFT_2 = "Session 2";
	public static String SHIFT_3 = "Session 3";
	public static String SHIFT_4 = "Session 4";
	
	@Column(name = "start_time", nullable = false)
	private Time startTime;
	
	@Column(name = "end_time", nullable = false)
	private Time endTime;
	
	@Column(name = "session")
	private String name;
	
	public Time getStartTime() {
		return startTime;
	}
	
	public void setStartTime(Time startTime) {
		this.startTime = startTime;
	}
	
	public Time getEndTime() {
		return endTime;
	}
	
	public void setEndTime(Time endTime) {
		this.endTime = endTime;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		String start = DateUtil.toString(this.startTime, "HH:mm");
		String end = DateUtil.toString(this.endTime, "HH:mm");
		return start + " - " + end;
	}
}